﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.Pipes;
using System.IO;


using GPSCrowdSource.DataStructures;
using System.Security.Principal;

namespace GPSCrowdSource.Algorithms {
  
  /// <summary>
  /// This utility class allows us to ask questions about what is going on with
  /// the gps data.
  /// </summary>
  public class KnowlegeBase {

    /// <summary>
    /// Request which line that a GPS value corresponds to.
    /// </summary>
    public static eRTDLine GetLine(GeoPosition inPos) {
      
      // Temporary.
      return eRTDLine.D;


      NamedPipeClientStream cpipe = new NamedPipeClientStream(".", "GPSPipe", PipeDirection.InOut);
      cpipe.Connect();

      if (cpipe.IsConnected)
          Console.WriteLine("we have connect");

      Console.WriteLine("Connected to pipe.");

      using (StreamReader sr = new StreamReader(cpipe))
      {
          // Display the read text to the console 
          string temp;
          while ((temp = sr.ReadLine()) != null)
          {
              Console.WriteLine("Received from server: {0}", temp);
          }
      }
            
      }

    }

  }
